package com.pyi.config.mybatisplus.controller;

import com.pyi.config.mybatisplus.model.Student;
import com.pyi.config.mybatisplus.service.impl.StudentServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.CacheConfig;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created with IntelliJ IDEA.
 *
 * @author : zjs
 * @Date: 2019/11/19 14:25
 * Description:
 */
@RestController
@RequestMapping("student")
public class StudentController {

    @Autowired
    private StudentServiceImpl studentService;
//    @Autowired
//    private RedisTemplate<Object, Object> myRedisTemplate;

    @GetMapping("/detail/{id}")
    @Cacheable(value = {"stu01"})
    public Object byId(@PathVariable Integer id){
        return studentService.getById(id);


    }

}
